package btcdemo.btcdemo.model;

/**
 * 交易输入
 * 
 * @author blues
 *
 */
public class TransactionInput {

	/**
	 * 引用的以前的交易id
	 */
	private String txId;
	/**
	 * 交易金额
	 */
	private int value;
	/**
	 * 交易签名
	 */
	private String signature;

	/**
	 * 交易发送方的钱包公钥
	 */
	private String sendAddress;

	/**
	 * 交易发送方的钱包公钥
	 */
	private String sendPublicKey;

	public TransactionInput() {}

	public TransactionInput(String txId, int value, String signature,String sendPublicKey) {
		this.txId = txId;
		this.value = value;
		this.signature = signature;
		this.sendAddress = Wallet.getAddressByPublicKey(sendPublicKey);
		this.sendPublicKey = sendPublicKey;
	}



	/** 系统挖矿交易输入 */
	public static TransactionInput getSystemTransactionInput(){
	    TransactionInput transactionInput = new TransactionInput();
	    transactionInput.setTxId("0");
	    transactionInput.setValue(-1);
	    return transactionInput;
    }







	public String getTxId() {
		return txId;
	}

	public void setTxId(String txId) {
		this.txId = txId;
	}

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}

	public String getSignature() {
		return signature;
	}

	public void setSignature(String signature) {
		this.signature = signature;
	}

	public String getSendAddress() {
		return sendAddress;
	}

	public void setSendAddress(String sendAddress) {
		this.sendAddress = sendAddress;
	}

	public String getSendPublicKey() {
		return sendPublicKey;
	}

	public void setSendPublicKey(String sendPublicKey) {
		this.sendPublicKey = sendPublicKey;
		this.sendAddress = Wallet.getAddressByPublicKey(sendPublicKey);
	}
}
